<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    
    <title>负熵为生  | Gitea安装</title>
    <meta name="viewport" content="width=device-width,minimum-scale=1">
    <meta name="generator" content="Hugo 0.81.0" />
    
    
      <META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
    

    
    
      <link href="/dist/css/app.1cb140d8ba31d5b2f1114537dd04802a.css" rel="stylesheet">
    

    

    
      
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />

    

    
    
    <meta property="og:title" content="Gitea安装" />
<meta property="og:description" content="资料  https://docs.gitea.io/zh-cn/  准备 # 数据库（MySQL） # https://docs.gitea.io/zh-cn/database-prep/ # 创建数据库 &gt; CREATE DATABASE DB_GITEA CHARACTER SET &#39;utf8mb4&#39; COLLATE &#39;utf8mb4_unicode_ci&#39;; # 创建用户 &gt; CREATE USER &#39;gitea&#39;@&#39;%&#39; IDENTIFIED WITH mysql_native_password BY &#39;Gitea!2020&#39;; # 用户授权 &gt; GRANT ALL PRIVILEGES ON DB_GITEA.* TO &#39;gitea&#39;@&#39;%&#39;; # 刷新权限，立即生效 &gt; FLUSH PRIVILEGES; # 用户 $ useradd gitea 安装 # 安装 # https://docs.gitea.io/zh-cn/install-from-binary/ # https://docs.gitea.io/zh-cn/install-from-package/ # https://docs.gitea.io/zh-cn/install-from-source/ $ curl -L https://dl.gitea.io/gitea/1.11.2/gitea-1.11.2-linux-amd64 -o /usr/local/bin/gitea $ chmod &#43;x /usr/local/bin/gitea # 测试 $ gitea -v Gitea version 1." />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://zlikun.gitee.io/post/devops/gitea%E5%AE%89%E8%A3%85/" /><meta property="article:section" content="post" />
<meta property="article:published_time" content="2020-03-18T22:48:27&#43;08:00" />
<meta property="article:modified_time" content="2020-03-18T22:48:27&#43;08:00" />

<meta itemprop="name" content="Gitea安装">
<meta itemprop="description" content="资料  https://docs.gitea.io/zh-cn/  准备 # 数据库（MySQL） # https://docs.gitea.io/zh-cn/database-prep/ # 创建数据库 &gt; CREATE DATABASE DB_GITEA CHARACTER SET &#39;utf8mb4&#39; COLLATE &#39;utf8mb4_unicode_ci&#39;; # 创建用户 &gt; CREATE USER &#39;gitea&#39;@&#39;%&#39; IDENTIFIED WITH mysql_native_password BY &#39;Gitea!2020&#39;; # 用户授权 &gt; GRANT ALL PRIVILEGES ON DB_GITEA.* TO &#39;gitea&#39;@&#39;%&#39;; # 刷新权限，立即生效 &gt; FLUSH PRIVILEGES; # 用户 $ useradd gitea 安装 # 安装 # https://docs.gitea.io/zh-cn/install-from-binary/ # https://docs.gitea.io/zh-cn/install-from-package/ # https://docs.gitea.io/zh-cn/install-from-source/ $ curl -L https://dl.gitea.io/gitea/1.11.2/gitea-1.11.2-linux-amd64 -o /usr/local/bin/gitea $ chmod &#43;x /usr/local/bin/gitea # 测试 $ gitea -v Gitea version 1."><meta itemprop="datePublished" content="2020-03-18T22:48:27&#43;08:00" />
<meta itemprop="dateModified" content="2020-03-18T22:48:27&#43;08:00" />
<meta itemprop="wordCount" content="786">
<meta itemprop="keywords" content="Git,Gitea,CI/CD," /><meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="Gitea安装"/>
<meta name="twitter:description" content="资料  https://docs.gitea.io/zh-cn/  准备 # 数据库（MySQL） # https://docs.gitea.io/zh-cn/database-prep/ # 创建数据库 &gt; CREATE DATABASE DB_GITEA CHARACTER SET &#39;utf8mb4&#39; COLLATE &#39;utf8mb4_unicode_ci&#39;; # 创建用户 &gt; CREATE USER &#39;gitea&#39;@&#39;%&#39; IDENTIFIED WITH mysql_native_password BY &#39;Gitea!2020&#39;; # 用户授权 &gt; GRANT ALL PRIVILEGES ON DB_GITEA.* TO &#39;gitea&#39;@&#39;%&#39;; # 刷新权限，立即生效 &gt; FLUSH PRIVILEGES; # 用户 $ useradd gitea 安装 # 安装 # https://docs.gitea.io/zh-cn/install-from-binary/ # https://docs.gitea.io/zh-cn/install-from-package/ # https://docs.gitea.io/zh-cn/install-from-source/ $ curl -L https://dl.gitea.io/gitea/1.11.2/gitea-1.11.2-linux-amd64 -o /usr/local/bin/gitea $ chmod &#43;x /usr/local/bin/gitea # 测试 $ gitea -v Gitea version 1."/>

  </head>

  <body class="ma0 avenir bg-near-white">

    
   
  

  <header>
    <div class="bg-black">
      <nav class="pv3 ph3 ph4-ns" role="navigation">
  <div class="flex-l justify-between items-center center">
    <a href="https://zlikun.gitee.io/" class="f3 fw2 hover-white no-underline white-90 dib">
      负熵为生
    </a>
    <div class="flex-l items-center">
      

      
      




<a href="https://twitter.com/zlikun" target="_blank" class="link-transition twitter link dib z-999 pt3 pt0-l mr1" title="Twitter link" rel="noopener" aria-label="follow on Twitter——Opens in a new window">
  <svg height="32px"  style="enable-background:new 0 0 67 67;" version="1.1" viewBox="0 0 67 67" width="32px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M37.167,22.283c-2.619,0.953-4.274,3.411-4.086,6.101  l0.063,1.038l-1.048-0.127c-3.813-0.487-7.145-2.139-9.974-4.915l-1.383-1.377l-0.356,1.017c-0.754,2.267-0.272,4.661,1.299,6.271  c0.838,0.89,0.649,1.017-0.796,0.487c-0.503-0.169-0.943-0.296-0.985-0.233c-0.146,0.149,0.356,2.076,0.754,2.839  c0.545,1.06,1.655,2.097,2.871,2.712l1.027,0.487l-1.215,0.021c-1.173,0-1.215,0.021-1.089,0.467  c0.419,1.377,2.074,2.839,3.918,3.475l1.299,0.444l-1.131,0.678c-1.676,0.976-3.646,1.526-5.616,1.568  C19.775,43.256,19,43.341,19,43.405c0,0.211,2.557,1.397,4.044,1.864c4.463,1.377,9.765,0.783,13.746-1.568  c2.829-1.673,5.657-5,6.978-8.221c0.713-1.716,1.425-4.851,1.425-6.354c0-0.975,0.063-1.102,1.236-2.267  c0.692-0.678,1.341-1.419,1.467-1.631c0.21-0.403,0.188-0.403-0.88-0.043c-1.781,0.636-2.033,0.551-1.152-0.402  c0.649-0.678,1.425-1.907,1.425-2.267c0-0.063-0.314,0.042-0.671,0.233c-0.377,0.212-1.215,0.53-1.844,0.72l-1.131,0.361l-1.027-0.7  c-0.566-0.381-1.361-0.805-1.781-0.932C39.766,21.902,38.131,21.944,37.167,22.283z M33,64C16.432,64,3,50.569,3,34S16.432,4,33,4  s30,13.431,30,30S49.568,64,33,64z" style="fill-rule:evenodd;clip-rule:evenodd;fill:;"/></svg>

<span class="new-window"><svg  height="8px"  style="enable-background:new 0 0 1000 1000;" version="1.1" viewBox="0 0 1000 1000" width="8px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" >
<path d="M598 128h298v298h-86v-152l-418 418-60-60 418-418h-152v-86zM810 810v-298h86v298c0 46-40 86-86 86h-596c-48 0-86-40-86-86v-596c0-46 38-86 86-86h298v86h-298v596h596z" style="fill-rule:evenodd;clip-rule:evenodd;fill:;"/>
</svg>
</span></a>





<a href="https://github.com/zlikun" target="_blank" class="link-transition github link dib z-999 pt3 pt0-l mr1" title="Github link" rel="noopener" aria-label="follow on Github——Opens in a new window">
  <svg  height="32px"  style="enable-background:new 0 0 512 512;" version="1.1" viewBox="0 0 512 512" width="32px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" >
  <path d="M256,32C132.3,32,32,134.8,32,261.7c0,101.5,64.2,187.5,153.2,217.9c11.2,2.1,15.3-5,15.3-11.1   c0-5.5-0.2-19.9-0.3-39.1c-62.3,13.9-75.5-30.8-75.5-30.8c-10.2-26.5-24.9-33.6-24.9-33.6c-20.3-14.3,1.5-14,1.5-14   c22.5,1.6,34.3,23.7,34.3,23.7c20,35.1,52.4,25,65.2,19.1c2-14.8,7.8-25,14.2-30.7c-49.7-5.8-102-25.5-102-113.5   c0-25.1,8.7-45.6,23-61.6c-2.3-5.8-10-29.2,2.2-60.8c0,0,18.8-6.2,61.6,23.5c17.9-5.1,37-7.6,56.1-7.7c19,0.1,38.2,2.6,56.1,7.7   c42.8-29.7,61.5-23.5,61.5-23.5c12.2,31.6,4.5,55,2.2,60.8c14.3,16.1,23,36.6,23,61.6c0,88.2-52.4,107.6-102.3,113.3   c8,7.1,15.2,21.1,15.2,42.5c0,30.7-0.3,55.5-0.3,63c0,6.1,4,13.3,15.4,11C415.9,449.1,480,363.1,480,261.7   C480,134.8,379.7,32,256,32z"/>
</svg>

<span class="new-window"><svg  height="8px"  style="enable-background:new 0 0 1000 1000;" version="1.1" viewBox="0 0 1000 1000" width="8px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" >
<path d="M598 128h298v298h-86v-152l-418 418-60-60 418-418h-152v-86zM810 810v-298h86v298c0 46-40 86-86 86h-596c-48 0-86-40-86-86v-596c0-46 38-86 86-86h298v86h-298v596h596z" style="fill-rule:evenodd;clip-rule:evenodd;fill:;"/>
</svg>
</span></a>







    </div>
  </div>
</nav>

    </div>
  </header>



    <main class="pb7" role="main">
      
  
  <article class="flex-l flex-wrap justify-between mw8 center ph3">
    <header class="mt4 w-100">
      <aside class="instapaper_ignoref b helvetica tracked">
          
        POSTS
      </aside>
      




  <div id="sharing" class="mt3">

    
    <a href="https://www.facebook.com/sharer.php?u=https://zlikun.gitee.io/post/devops/gitea%E5%AE%89%E8%A3%85/" class="facebook no-underline" aria-label="share on Facebook">
      <svg height="32px"  style="enable-background:new 0 0 67 67;" version="1.1" viewBox="0 0 67 67" width="32px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M28.765,50.32h6.744V33.998h4.499l0.596-5.624h-5.095  l0.007-2.816c0-1.466,0.14-2.253,2.244-2.253h2.812V17.68h-4.5c-5.405,0-7.307,2.729-7.307,7.317v3.377h-3.369v5.625h3.369V50.32z   M33,64C16.432,64,3,50.569,3,34S16.432,4,33,4s30,13.431,30,30S49.568,64,33,64z" style="fill-rule:evenodd;clip-rule:evenodd;"/></svg>

    </a>

    
    
    <a href="https://twitter.com/share?url=https://zlikun.gitee.io/post/devops/gitea%E5%AE%89%E8%A3%85/&amp;text=Gitea%e5%ae%89%e8%a3%85" class="twitter no-underline" aria-label="share on Twitter">
      <svg height="32px"  style="enable-background:new 0 0 67 67;" version="1.1" viewBox="0 0 67 67" width="32px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M37.167,22.283c-2.619,0.953-4.274,3.411-4.086,6.101  l0.063,1.038l-1.048-0.127c-3.813-0.487-7.145-2.139-9.974-4.915l-1.383-1.377l-0.356,1.017c-0.754,2.267-0.272,4.661,1.299,6.271  c0.838,0.89,0.649,1.017-0.796,0.487c-0.503-0.169-0.943-0.296-0.985-0.233c-0.146,0.149,0.356,2.076,0.754,2.839  c0.545,1.06,1.655,2.097,2.871,2.712l1.027,0.487l-1.215,0.021c-1.173,0-1.215,0.021-1.089,0.467  c0.419,1.377,2.074,2.839,3.918,3.475l1.299,0.444l-1.131,0.678c-1.676,0.976-3.646,1.526-5.616,1.568  C19.775,43.256,19,43.341,19,43.405c0,0.211,2.557,1.397,4.044,1.864c4.463,1.377,9.765,0.783,13.746-1.568  c2.829-1.673,5.657-5,6.978-8.221c0.713-1.716,1.425-4.851,1.425-6.354c0-0.975,0.063-1.102,1.236-2.267  c0.692-0.678,1.341-1.419,1.467-1.631c0.21-0.403,0.188-0.403-0.88-0.043c-1.781,0.636-2.033,0.551-1.152-0.402  c0.649-0.678,1.425-1.907,1.425-2.267c0-0.063-0.314,0.042-0.671,0.233c-0.377,0.212-1.215,0.53-1.844,0.72l-1.131,0.361l-1.027-0.7  c-0.566-0.381-1.361-0.805-1.781-0.932C39.766,21.902,38.131,21.944,37.167,22.283z M33,64C16.432,64,3,50.569,3,34S16.432,4,33,4  s30,13.431,30,30S49.568,64,33,64z" style="fill-rule:evenodd;clip-rule:evenodd;fill:;"/></svg>

    </a>

    
    <a href="https://www.linkedin.com/shareArticle?mini=true&amp;url=https://zlikun.gitee.io/post/devops/gitea%E5%AE%89%E8%A3%85/&amp;title=Gitea%e5%ae%89%e8%a3%85" class="linkedin no-underline" aria-label="share on LinkedIn">
      <svg  height="32px"  style="enable-background:new 0 0 65 65;" version="1.1" viewBox="0 0 65 65" width="32px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  <path d="M50.837,48.137V36.425c0-6.275-3.35-9.195-7.816-9.195  c-3.604,0-5.219,1.983-6.119,3.374V27.71h-6.79c0.09,1.917,0,20.427,0,20.427h6.79V36.729c0-0.609,0.044-1.219,0.224-1.655  c0.49-1.22,1.607-2.483,3.482-2.483c2.458,0,3.44,1.873,3.44,4.618v10.929H50.837z M22.959,24.922c2.367,0,3.842-1.57,3.842-3.531  c-0.044-2.003-1.475-3.528-3.797-3.528s-3.841,1.524-3.841,3.528c0,1.961,1.474,3.531,3.753,3.531H22.959z M34,64  C17.432,64,4,50.568,4,34C4,17.431,17.432,4,34,4s30,13.431,30,30C64,50.568,50.568,64,34,64z M26.354,48.137V27.71h-6.789v20.427  H26.354z" style="fill-rule:evenodd;clip-rule:evenodd;fill:;"/>
</svg>

    </a>
  </div>

      <h1 class="f1 athelas mt3 mb1">Gitea安装</h1>
      
      
      <time class="f6 mv4 dib tracked" datetime="2020-03-18T22:48:27&#43;08:00">March 18, 2020</time>

      
      
    </header>
    <div class="nested-copy-line-height lh-copy serif f4 nested-links nested-img mid-gray pr4-l w-two-thirds-l"><h3 id="资料">资料</h3>
<ul>
<li><a href="https://docs.gitea.io/zh-cn/">https://docs.gitea.io/zh-cn/</a></li>
</ul>
<h3 id="准备">准备</h3>
<pre><code># 数据库（MySQL）
# https://docs.gitea.io/zh-cn/database-prep/
# 创建数据库
&gt; CREATE DATABASE DB_GITEA CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_unicode_ci';
# 创建用户
&gt; CREATE USER 'gitea'@'%' IDENTIFIED WITH mysql_native_password BY 'Gitea!2020';
# 用户授权
&gt; GRANT ALL PRIVILEGES ON DB_GITEA.* TO 'gitea'@'%';
# 刷新权限，立即生效
&gt; FLUSH PRIVILEGES;

# 用户
$ useradd gitea
</code></pre><h3 id="安装httpsdocsgiteaiozh-cninstall-from-binary"><a href="https://docs.gitea.io/zh-cn/install-from-binary/">安装</a></h3>
<pre><code># 安装
# https://docs.gitea.io/zh-cn/install-from-binary/
# https://docs.gitea.io/zh-cn/install-from-package/
# https://docs.gitea.io/zh-cn/install-from-source/
$ curl -L https://dl.gitea.io/gitea/1.11.2/gitea-1.11.2-linux-amd64 -o /usr/local/bin/gitea
$ chmod +x /usr/local/bin/gitea

# 测试
$ gitea -v
Gitea version 1.11.2 built with GNU Make 4.1, go1.14 : bindata, sqlite, sqlite_unlock_notify

# http://192.168.1.102:3000/
$ gitea web
</code></pre><h3 id="命令">命令</h3>
<pre><code>$ gitea -h
NAME:
   Gitea - A painless self-hosted Git service

USAGE:
   gitea [global options] command [command options] [arguments...]

VERSION:
   1.11.2 built with GNU Make 4.1, go1.14 : bindata, sqlite, sqlite_unlock_notify

DESCRIPTION:
   By default, gitea will start serving using the webserver with no
arguments - which can alternatively be run by running the subcommand web.

COMMANDS:
     web       Start Gitea web server
     serv      This command should only be called by SSH shell
     hook      Delegate commands to corresponding Git hooks
     dump      Dump Gitea files and database
     cert      Generate self-signed certificate
     admin     Command line interface to perform common administrative operations
     generate  Command line interface for running generators
     migrate   Migrate the database
     keys      This command queries the Gitea database to get the authorized command for a given ssh key fingerprint
     convert   Convert the database
     help, h   Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --port value, -p value         Temporary port number to prevent conflict (default: &quot;3000&quot;)
   --pid value, -P value          Custom pid file path (default: &quot;/var/run/gitea.pid&quot;)
   --custom-path value, -C value  Custom path file path (default: &quot;/usr/local/bin/custom&quot;)
   --config value, -c value       Custom configuration file path (default: &quot;/usr/local/bin/custom/conf/app.ini&quot;)
   --version, -v                  print the version
   --work-path value, -w value    Set the gitea working path (default: &quot;/usr/local/bin&quot;)
   --help, -h                     show help

DEFAULT CONFIGURATION:
     CustomPath:  /usr/local/bin/custom 
     CustomConf:  /usr/local/bin/custom/conf/app.ini
     AppPath:     /usr/local/bin/gitea
     AppWorkPath: /usr/local/bin
</code></pre><h3 id="配置httpsdocsgiteaioen-usconfig-cheat-sheet"><a href="https://docs.gitea.io/en-us/config-cheat-sheet/">配置</a></h3>
<pre><code># 创建配置文件目录
$ mkdir /etc/gitea
# 默认会相对于 gitea 可执行程序生成 custom/conf/app.ini 配置文件
# 建议按标准目录创建该文件，并在启动 gitea 服务时指定配置文件路径
# 官方配置文件模板：https://github.com/go-gitea/gitea/blob/master/custom/conf/app.ini.sample
$ touch /etc/gitea/app.ini

[database]
; ; Either &quot;mysql&quot;, &quot;postgres&quot;, &quot;mssql&quot; or &quot;sqlite3&quot;, it's your choice
DB_TYPE = mysql
HOST = 192.168.1.104:3306
NAME = DB_GITEA
USER = gitea
; ; Use PASSWD = `your password` for quoting if you use special characters in the password.
PASSWD = Gitea!2020@zlikun.com
; ; For Postgres, schema to use if different from &quot;public&quot;. The schema must exist beforehand,
; ; the user must have creation privileges on it, and the user search path must be set
; ; to the look into the schema first. e.g.:ALTER USER user SET SEARCH_PATH = schema_name,&quot;$user&quot;,public;
; SCHEMA =
; ; For Postgres, either &quot;disable&quot; (default), &quot;require&quot;, or &quot;verify-full&quot;
; ; For MySQL, either &quot;false&quot; (default), &quot;true&quot;, or &quot;skip-verify&quot;
; SSL_MODE = disable
; ; For MySQL only, either &quot;utf8&quot; or &quot;utf8mb4&quot;, default is &quot;utf8&quot;.
; ; NOTICE: for &quot;utf8mb4&quot; you must use MySQL InnoDB &gt; 5.6. Gitea is unable to check this.
CHARSET = utf8mb4
</code></pre><h3 id="服务httpsdocsgiteaiozh-cnlinux-service"><a href="https://docs.gitea.io/zh-cn/linux-service/">服务</a></h3>
<p>前置</p>
<pre><code>$ mkdir /etc/gitea
$ chown gitea:gitea -R /etc/gitea

$ mkdir /var/lib/gitea
$ chown gitea:gitea -R /var/lib/gitea
</code></pre><p>脚本</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-service" data-lang="service"><span style="color:#75715e"># /etc/systemd/system/gitea.service</span>
<span style="color:#66d9ef">[Unit]</span>
<span style="color:#a6e22e">Description</span><span style="color:#f92672">=</span><span style="color:#e6db74">Gitea (Git with a cup of tea)</span>
<span style="color:#a6e22e">After</span><span style="color:#f92672">=</span><span style="color:#e6db74">syslog.target</span>
<span style="color:#a6e22e">After</span><span style="color:#f92672">=</span><span style="color:#e6db74">network.target</span>
<span style="color:#75715e">#</span>
<span style="color:#75715e">###</span>
<span style="color:#75715e"># If using socket activation for main http/s</span>
<span style="color:#75715e">###</span>
<span style="color:#75715e">#</span>
<span style="color:#75715e">#After=gitea.main.socket</span>
<span style="color:#75715e">#Requires=gitea.main.socket</span>
<span style="color:#75715e">#</span>
<span style="color:#75715e">###</span>
<span style="color:#75715e"># (You can also provide gitea an http fallback and/or ssh socket too)</span>
<span style="color:#75715e">#</span>
<span style="color:#75715e"># An example of /etc/systemd/system/gitea.main.socket</span>
<span style="color:#75715e">###</span>
<span style="color:#75715e">##</span>
<span style="color:#75715e">## [Unit]</span>
<span style="color:#75715e">## Description=Gitea Web Socket</span>
<span style="color:#75715e">## PartOf=gitea.service</span>
<span style="color:#75715e">##</span>
<span style="color:#75715e">## [Socket]</span>
<span style="color:#75715e">## Service=gitea.service</span>
<span style="color:#75715e">## ListenStream=&lt;some_port&gt;</span>
<span style="color:#75715e">## NoDelay=true</span>
<span style="color:#75715e">##</span>
<span style="color:#75715e">## [Install]</span>
<span style="color:#75715e">## WantedBy=sockets.target</span>
<span style="color:#75715e">##</span>
<span style="color:#75715e">###</span>

<span style="color:#66d9ef">[Service]</span>
<span style="color:#75715e"># Modify these two values and uncomment them if you have</span>
<span style="color:#75715e"># repos with lots of files and get an HTTP error 500 because</span>
<span style="color:#75715e"># of that</span>
<span style="color:#75715e">###</span>
<span style="color:#75715e">#LimitMEMLOCK=infinity</span>
<span style="color:#75715e">#LimitNOFILE=65535</span>
<span style="color:#a6e22e">RestartSec</span><span style="color:#f92672">=</span><span style="color:#e6db74">2s</span>
<span style="color:#a6e22e">Type</span><span style="color:#f92672">=</span><span style="color:#e6db74">simple</span>
<span style="color:#a6e22e">User</span><span style="color:#f92672">=</span><span style="color:#e6db74">gitea</span>
<span style="color:#a6e22e">Group</span><span style="color:#f92672">=</span><span style="color:#e6db74">gitea</span>
<span style="color:#a6e22e">WorkingDirectory</span><span style="color:#f92672">=</span><span style="color:#e6db74">/var/lib/gitea/</span>
<span style="color:#75715e"># If using Unix socket: tells systemd to create the /run/gitea folder, which will contain the gitea.sock file</span>
<span style="color:#75715e"># (manually creating /run/gitea doesn&#39;t work, because it would not persist across reboots)</span>
<span style="color:#75715e">#RuntimeDirectory=gitea</span>
<span style="color:#a6e22e">ExecStart</span><span style="color:#f92672">=</span><span style="color:#e6db74">/usr/local/bin/gitea web --config /etc/gitea/app.ini</span>
<span style="color:#a6e22e">Restart</span><span style="color:#f92672">=</span><span style="color:#e6db74">always</span>
<span style="color:#a6e22e">Environment</span><span style="color:#f92672">=</span><span style="color:#e6db74">USER=git HOME=/home/gitea GITEA_WORK_DIR=/var/lib/gitea</span>
<span style="color:#75715e"># If you want to bind Gitea to a port below 1024, uncomment</span>
<span style="color:#75715e"># the two values below, or use socket activation to pass Gitea its ports as above</span>
<span style="color:#75715e">###</span>
<span style="color:#75715e">#CapabilityBoundingSet=CAP_NET_BIND_SERVICE</span>
<span style="color:#75715e">#AmbientCapabilities=CAP_NET_BIND_SERVICE</span>
<span style="color:#75715e">###</span>

<span style="color:#66d9ef">[Install]</span>
<span style="color:#a6e22e">WantedBy</span><span style="color:#f92672">=</span><span style="color:#e6db74">multi-user.target</span>
</code></pre></div><h3 id="反代">反代</h3>
<pre><code class="language-conf" data-lang="conf"># gitea.i.zlikun.com.conf
server {
    listen       80;
    server_name  gitea.i.zlikun.com;

    # allow large uploads of files - refer to nginx documentation
    client_max_body_size 128M;

    location / {
        proxy_pass          http://192.168.1.102:3000/;
        proxy_set_header    Host $host;
        proxy_set_header    X-Real-IP $remote_addr;
        proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

server {
    listen       443 ssl http2 default_server;
    listen       [::]:443 ssl http2 default_server;
    server_name  nexus.i.zlikun.com;

    # allow large uploads of files - refer to nginx documentation
    client_max_body_size 128M;

    ssl on;
    ssl_certificate         gitea.i.zlikun.com.pem;
    ssl_certificate_key     gitea.i.zlikun.com.key;

    location / {
        proxy_pass          http://192.168.1.102:3000/;
        proxy_set_header    Host $host;
        proxy_set_header    X-Real-IP $remote_addr;
        proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header    X-Forwarded-Proto https;
    }
}
</code></pre><h3 id="设置">设置</h3>
<p><code>Gitea</code> 可以通过UI来设置数据库、邮件配置、管理员帐号等信息，系统第一个用户登录时会弹出设置表单</p>
<pre><code># 管理员
gitea / gitea@admin / gitea@zlikun.com
</code></pre><ul class="pa0">
  
   <li class="list">
     <a href="/tags/git" class="link f5 grow no-underline br-pill ba ph3 pv2 mb2 dib black sans-serif">Git</a>
   </li>
  
   <li class="list">
     <a href="/tags/gitea" class="link f5 grow no-underline br-pill ba ph3 pv2 mb2 dib black sans-serif">Gitea</a>
   </li>
  
   <li class="list">
     <a href="/tags/ci/cd" class="link f5 grow no-underline br-pill ba ph3 pv2 mb2 dib black sans-serif">CI/CD</a>
   </li>
  
</ul>
<div class="mt6 instapaper_ignoref">
      
      
      </div>
    </div>

    <aside class="w-30-l mt6-l">




</aside>

  </article>

    </main>
    <footer class="bg-black bottom-0 w-100 pa3" role="contentinfo">
  <div class="flex justify-between">
  <a class="f4 fw4 hover-white no-underline white-70 dn dib-ns pv2 ph3" href="https://zlikun.gitee.io/" >
    &copy;  负熵为生 2021 
  </a>
    <div>




<a href="https://twitter.com/zlikun" target="_blank" class="link-transition twitter link dib z-999 pt3 pt0-l mr1" title="Twitter link" rel="noopener" aria-label="follow on Twitter——Opens in a new window">
  <svg height="32px"  style="enable-background:new 0 0 67 67;" version="1.1" viewBox="0 0 67 67" width="32px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M37.167,22.283c-2.619,0.953-4.274,3.411-4.086,6.101  l0.063,1.038l-1.048-0.127c-3.813-0.487-7.145-2.139-9.974-4.915l-1.383-1.377l-0.356,1.017c-0.754,2.267-0.272,4.661,1.299,6.271  c0.838,0.89,0.649,1.017-0.796,0.487c-0.503-0.169-0.943-0.296-0.985-0.233c-0.146,0.149,0.356,2.076,0.754,2.839  c0.545,1.06,1.655,2.097,2.871,2.712l1.027,0.487l-1.215,0.021c-1.173,0-1.215,0.021-1.089,0.467  c0.419,1.377,2.074,2.839,3.918,3.475l1.299,0.444l-1.131,0.678c-1.676,0.976-3.646,1.526-5.616,1.568  C19.775,43.256,19,43.341,19,43.405c0,0.211,2.557,1.397,4.044,1.864c4.463,1.377,9.765,0.783,13.746-1.568  c2.829-1.673,5.657-5,6.978-8.221c0.713-1.716,1.425-4.851,1.425-6.354c0-0.975,0.063-1.102,1.236-2.267  c0.692-0.678,1.341-1.419,1.467-1.631c0.21-0.403,0.188-0.403-0.88-0.043c-1.781,0.636-2.033,0.551-1.152-0.402  c0.649-0.678,1.425-1.907,1.425-2.267c0-0.063-0.314,0.042-0.671,0.233c-0.377,0.212-1.215,0.53-1.844,0.72l-1.131,0.361l-1.027-0.7  c-0.566-0.381-1.361-0.805-1.781-0.932C39.766,21.902,38.131,21.944,37.167,22.283z M33,64C16.432,64,3,50.569,3,34S16.432,4,33,4  s30,13.431,30,30S49.568,64,33,64z" style="fill-rule:evenodd;clip-rule:evenodd;fill:;"/></svg>

<span class="new-window"><svg  height="8px"  style="enable-background:new 0 0 1000 1000;" version="1.1" viewBox="0 0 1000 1000" width="8px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" >
<path d="M598 128h298v298h-86v-152l-418 418-60-60 418-418h-152v-86zM810 810v-298h86v298c0 46-40 86-86 86h-596c-48 0-86-40-86-86v-596c0-46 38-86 86-86h298v86h-298v596h596z" style="fill-rule:evenodd;clip-rule:evenodd;fill:;"/>
</svg>
</span></a>





<a href="https://github.com/zlikun" target="_blank" class="link-transition github link dib z-999 pt3 pt0-l mr1" title="Github link" rel="noopener" aria-label="follow on Github——Opens in a new window">
  <svg  height="32px"  style="enable-background:new 0 0 512 512;" version="1.1" viewBox="0 0 512 512" width="32px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" >
  <path d="M256,32C132.3,32,32,134.8,32,261.7c0,101.5,64.2,187.5,153.2,217.9c11.2,2.1,15.3-5,15.3-11.1   c0-5.5-0.2-19.9-0.3-39.1c-62.3,13.9-75.5-30.8-75.5-30.8c-10.2-26.5-24.9-33.6-24.9-33.6c-20.3-14.3,1.5-14,1.5-14   c22.5,1.6,34.3,23.7,34.3,23.7c20,35.1,52.4,25,65.2,19.1c2-14.8,7.8-25,14.2-30.7c-49.7-5.8-102-25.5-102-113.5   c0-25.1,8.7-45.6,23-61.6c-2.3-5.8-10-29.2,2.2-60.8c0,0,18.8-6.2,61.6,23.5c17.9-5.1,37-7.6,56.1-7.7c19,0.1,38.2,2.6,56.1,7.7   c42.8-29.7,61.5-23.5,61.5-23.5c12.2,31.6,4.5,55,2.2,60.8c14.3,16.1,23,36.6,23,61.6c0,88.2-52.4,107.6-102.3,113.3   c8,7.1,15.2,21.1,15.2,42.5c0,30.7-0.3,55.5-0.3,63c0,6.1,4,13.3,15.4,11C415.9,449.1,480,363.1,480,261.7   C480,134.8,379.7,32,256,32z"/>
</svg>

<span class="new-window"><svg  height="8px"  style="enable-background:new 0 0 1000 1000;" version="1.1" viewBox="0 0 1000 1000" width="8px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" >
<path d="M598 128h298v298h-86v-152l-418 418-60-60 418-418h-152v-86zM810 810v-298h86v298c0 46-40 86-86 86h-596c-48 0-86-40-86-86v-596c0-46 38-86 86-86h298v86h-298v596h596z" style="fill-rule:evenodd;clip-rule:evenodd;fill:;"/>
</svg>
</span></a>






</div>
  </div>
</footer>

    

  <script src="/dist/js/app.3fc0f988d21662902933.js"></script>


  </body>
</html>
